package com.wksc.framework.impexp.template;

import com.wksc.framework.impexp.bean.BaseFormatParams;
import com.wksc.framework.impexp.bean.Header;
import com.wksc.framework.impexp.constants.TaskType;

import java.io.Serializable;
import java.util.Date;

/**
 * <p> Title(文件名): BaseTemplate.java </p>
 * <p> Description(描述): 导入导出模板的父类 </p>
 * <p> Copyright(版权): Copyright (c) 2011 </p>
 * <p> Company(公司): 成都四方信息技术有限公司 </p>
 * <p> CreateTime(生成日期)：2011-10-25下午03:51:19 </p>
 * @author wanglei
 * @version impExp_C13
 */
public abstract class BaseTemplate implements Serializable{
	
	private static final long serialVersionUID = 2875446677888453900L;

	/*此部分为导入导出共有的属性*/
	
	/**导入或导出的文件名*/
	protected String fileName;
	
	/**导入导出任务的操作员*/
	protected String operator;
	
	/** 系统自定义的保存用户信息的对象 */
	protected Object users;
	
	/**建立任务的时间*/
	protected Date createTime;
	
	/**执行导入导出任务的客户端ip地址*/
	protected String ip;
	
	/**导入导出的模块类型*/
	protected String typeName;
	
	/**导入导出项的完整表头*/
	protected Header[] fullHeader;

	/**此模板具体的任务类型,即是导出任务还是导入任务*/
	private TaskType taskType;

    /**此项属性主要用于指导写文件的类将哪些输入写入文件
     * 在导出中为页面显示的表头在完整表头中的顺序,
     * 在导入中为错误项数据的行号
     */
	protected Integer[] writeOrder;

    /**格式化单元格需要用到的权限信息集合*/
    protected BaseFormatParams formatParams;
    
    /**日志入库的操作对象
     * 黑名单 1
     * 关键字 2
     * 其他 -1*/
    protected int operatObj = (byte)-1;

    /**
     * Template的构造函数
     * @param operator   操作用户
     * @param typeName 导入导出的模块类型
     * @param fullHeader 完整表头信息
     */
	public BaseTemplate(String operator, String typeName, int operatObj,
			Header[] fullHeader) {
		this.operator = operator;
		this.typeName = typeName;
		this.fullHeader = fullHeader;
		this.operatObj = operatObj;
		init();
	}

	/**
     * 初始化模板中一些属性
     */
    private void init(){
        //权限参数集合初始化
    	if(null == formatParams){
    		formatParams = new BaseFormatParams();
    	}
    }

    /*=========setters & getters==============*/
	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public Object getUsers() {
		return users;
	}

	public void setUsers(Object users) {
		this.users = users;
	}

	public Date getCreatTime() {
		return createTime;
	}

	public void setCreatTime(Date creatTime) {
		this.createTime = creatTime;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public Header[] getFullHeader() {
		return fullHeader;
	}

	public void setFullHeader(Header[] fullHeader) {
		this.fullHeader = fullHeader;
	}

	public TaskType getTaskType() {
		return taskType;
	}
	
	public void setTaskType(TaskType taskType){
		this.taskType = taskType;
	}

    public Integer[] getWriteOrder() {
        return writeOrder;
    }

    public void setWriteOrder(Integer[] writeOrder) {
        this.writeOrder = writeOrder;
    }

    public BaseFormatParams getFormatParams() {
        return formatParams;
    }

    public void setFormatParams(BaseFormatParams formatParams) {
        this.formatParams = formatParams;
    }

	public int getOperatObj() {
		return operatObj;
	}

	public void setOperatObj(int operatObj) {
		this.operatObj = operatObj;
	}
    /*=========setters & getters==============*/
}
